<template>
  <div class="ticket-outer">
    <div class="ticket" :style="{ background: randomBg() }">
      <img :src="icon" alt="" />
      <span>{{ name }}</span>
    </div>
    <div class="divider">
      <div class="triangle-down"></div>
      <div class="line"></div>
      <div class="triangle-up"></div>
    </div>
  </div>
</template>

<script>
const bgs = [
  "#ef6f6f",
  "#57b49d",
  "linear-gradient(177deg, #6da1ff -12%, #062dff 83%)",
  "linear-gradient(168deg, #f8897d -10%, #ec6265 61%)",
  "linear-gradient(172deg, #6ddad7 -10%, #3daeb2 58%)",
  "linear-gradient(177deg, #6da1ff -12%, #062dff 83%)",
  "linear-gradient(168deg, #f8897d -10%, #ec6265 61%)",
  "linear-gradient(172deg, #6ddad7 -10%, #3daeb2 58%)",
  "linear-gradient(177deg, #6da1ff -12%, #062dff 83%)",
  "linear-gradient(168deg, #f8897d -10%, #ec6265 61%)",
  "linear-gradient(172deg, #6ddad7 -10%, #3daeb2 58%)"
];
export default {
  name: "Ticket",
  props: {
    // icon: {
    //   type: Object,
    //   default: () => {
    //     return require("@/assets/img/logo.png");
    //   }
    // },
    icon: String,
    name: String,
    index: Number
  },
  data() {
    return {};
  },
  methods: {
    randomBg() {
      // return bgs[Math.floor(Math.random() * bgs.length)];
      return bgs[this.index];
    }
  }
};
</script>

<style scoped lang="less">
.ticket-outer {
  position: relative;

  .divider {
    position: absolute;
    top: 0;
    bottom: 0;
    width: 20px;
    height: 100%;
    right: 80px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    align-items: center;

    .line {
      height: 100%;
      border-left: 1px dotted #ffffff;
    }

    .triangle-down {
      width: 0;
      height: 0;
      border-left: 10px solid transparent;
      border-right: 10px solid transparent;
      border-top: 8px solid #ffffff;
    }

    .triangle-up {
      width: 0;
      height: 0;
      border-left: 10px solid transparent;
      border-right: 10px solid transparent;
      border-bottom: 8px solid #ffffff;
    }
  }

  .ticket {
    width: 345px;
    height: 70px;
    //background: #ef6f6f;
    border-radius: 10px;
    display: flex;
    align-items: center;

    img {
      width: 24px;
      height: 24px;
      margin-left: 20px;
    }

    span {
      margin-left: 15px;
      height: 22px;
      line-height: 22px;
      font-size: 16px;
      font-weight: 500;
      color: #ffffff;
    }
  }
}
</style>
